package com.fengke.dao.model;

import java.math.BigDecimal;

import org.apache.commons.lang3.builder.ToStringBuilder;

import com.fengke.dao.model.MemberModel.Gender;

public class OrderItemModel extends BaseEntity {
	private static final long serialVersionUID = 1L;
	/** 商品全称 */
    private String fullName;
    /** 是否为赠品 */
    private Boolean isGift;
    /** 商品名称 */
    private String name;
    /** 商品价格 */
    private BigDecimal price;
    /** 数量 */
    private Integer quantity;
    /** 商品编号 */
    private String sn;
    /** 商品 */
    private ProductModel product;
    /** 订单 */
    private OrderModel order;
    /** 成员名字 */
    private String memberName;
    /** 成员性别 */
    private Gender gender;
    private Integer mgender;
    /** 是否为成人*/
    private Boolean isAdult=true;
    
    public BigDecimal getSubtotal()
    {
        if (getPrice() != null && getQuantity() != null)
        {
            return getPrice().multiply(new BigDecimal(getQuantity()));
        }
        else
        {
            return new BigDecimal(0);
        }
    }
    @Override
    public String toString() {
    	return ToStringBuilder.reflectionToString(this);
    }
	public String getFullName() {
		return fullName;
	}
	public void setFullName(String fullName) {
		this.fullName = fullName;
	}
	public Boolean getIsGift() {
		return isGift;
	}
	public void setIsGift(Boolean isGift) {
		this.isGift = isGift;
	}
	public String getName() {
		return name;
	}
	public void setName(String name) {
		this.name = name;
	}
	public BigDecimal getPrice() {
		return price;
	}
	public void setPrice(BigDecimal price) {
		this.price = price;
	}
	public Integer getQuantity() {
		return quantity;
	}
	public void setQuantity(Integer quantity) {
		this.quantity = quantity;
	}
	public String getSn() {
		return sn;
	}
	public void setSn(String sn) {
		this.sn = sn;
	}
	public ProductModel getProduct() {
		return product;
	}
	public void setProduct(ProductModel product) {
		this.product = product;
	}
	public OrderModel getOrder() {
		return order;
	}
	public void setOrder(OrderModel order) {
		this.order = order;
	}
	public String getMemberName() {
		return memberName;
	}
	public void setMemberName(String memberName) {
		this.memberName = memberName;
	}
	public Gender getGender() {
		return gender;
	}
	public void setGender(Gender gender) {
		this.gender = gender;
	}
	public Integer getMgender() {
		this.mgender = this.gender.getGender();
		return mgender;
	}

	public void setMgender(Integer mgender) {
		if(mgender == null) {
			return;
		}
		if(mgender == Gender.male.getGender()) {
			this.gender = Gender.male;
		} else if(mgender == Gender.female.getGender()) {
			this.gender = Gender.female;
		}
		this.mgender = this.gender.getGender();
	}
	public Boolean getIsAdult() {
		return isAdult;
	}
	public void setIsAdult(Boolean isAdult) {
		this.isAdult = isAdult;
	}
}
